<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>P159 【例7-4】demo04.html</title>
    <style>
        .bg {
            background: #ccc;
        }

        .strong {
            font-size: 30px;
            color: red;
        }

        .smooth {
            height: 30px;
            width: 120px;
            border-radius: 10px;
        }
    </style>
</head>

<body>
    <ul>
        <li>PHP</li>
        <li class="bg">JavaScript</li>
        <li>C++</li>
        <li>Java</li>
    </ul>
    <script>
        var ele = document.getElementsByTagName('li')[1];
        if (!ele.classList.contains('strong')) {
            ele.classList.add('strong');
        }
        ele.classList.toggle('smooth');
        ele.classList.remove('bg');
        console.log('删除后：');
        console.log(ele);
    </script>
    <a href="../首页/page07.html">
        <h2>返回上一页面</h2>
    </a>
</body>

</html>